-- addition_damage
-- create by panyl
-- 道具：  致命伤害

return {
    apply = function(source, target, classId, value)
        -- 对特定的怪物伤害有加成
        if table.indexOf(value[1], target:query("base_class_id")) == -1 then
            value = value[2];
        else
            value = value[3];
        end

        -- 计算最终伤害
        local damage = PropertyM.calcFinalDamage(source, target, classId, value);

        -- 固定伤害
        -- 传入攻击者信息
        local assailantInfo = {
                ["property_id"] = classId,
        };

        if ItemM.query(classId, "apply") == "damage_and_drop" then
            -- 会掉落道具
            CombatM.doDamage(source, target, damage, 0, true, { assailantInfo = assailantInfo, });
        else
            CombatM.doDamage(source, target, damage, 0, false, { assailantInfo = assailantInfo, });
        end

        -- 抛出使用道具攻击事件
        EventMgr.fire(event.PROPERTY_ATTACK, { ["classId"] = classId, ["target"] = target, });
    end,
};
